package org.hive.hive;
import java.util.List;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import android.graphics.Point;
import android.graphics.Canvas;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class map extends MapActivity {
  

MapView mapView; 
MapController mc;
GeoPoint p;
 
 
   @Override
   public void onCreate(Bundle savedInstanceState) {
	   super.onCreate(savedInstanceState);
       setContentView(R.layout.map);

       mapView = (MapView) findViewById(R.id.mapView);
       
       MapController mc = mapView.getController();
       //String coordinates[] = {"40.506657", "-74.43581"};
       float lat = Global.sel_pho_lat;
       float lng = Global.sel_pho_lng;
           GeoPoint p = new GeoPoint(
           (int) (lat * 1E6), 
           (int) (lng * 1E6));
       mc.animateTo(p);
       mc.setZoom(17); 
       MapOverlay mapOverlay = new MapOverlay();
       mapOverlay.setPointToDraw(p);
       List<Overlay> listOfOverlays = mapView.getOverlays();
       listOfOverlays.clear();
       listOfOverlays.add(mapOverlay);
       mapView.invalidate();
     }
class MapOverlay extends Overlay
{
	private GeoPoint pointToDraw;
	public void setPointToDraw(GeoPoint point){
		pointToDraw = point;
	}
	public GeoPoint getPointToDraw(){
		return pointToDraw;
	}
public boolean draw(Canvas canvas,MapView mapView,boolean shadow,long when)
{
	super.draw(canvas, mapView, shadow);
	Point screenPts = new Point();
	mapView.getProjection().toPixels(pointToDraw, screenPts);
	Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.red);
	canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 24,null);
return true;
}
}
@Override
protected boolean isRouteDisplayed() {
	// TODO Auto-generated method stub
	return false;
}
  
}
